package lab01;

import java.util.Scanner;

public class Test06 {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("enter a student's garde(1,2,3,4,5):");
        int num = sc.nextInt();

        printIfElse(num);
        printSwitch(num);
    }

    public static void printIfElse(int num) {

        if (num == 1) {
            System.out.println("不合格");
        } else if (num == 2) {
            System.out.println("及格");
        }else if (num == 3) {
            System.out.println("中等");
        }else if (num == 4) {
            System.out.println("良好");
        }else if (num == 5) {
            System.out.println("优秀");
        }else {
            System.out.println("failed：输入的数字超出范围");
        }
    }

    public static void printSwitch(int num){

        switch (num) {
            case 1:
                System.out.println("不合格");break;
            case 2:
                System.out.println("及格");break;
            case 3:
                System.out.println("中等");break;
            case 4:
                System.out.println("良好");break;
            case 5:
                System.out.println("优秀");break;
            default:
                System.out.println("failed：输入的数字超出范围");
        }
    }
}
